/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Metodos;

/**
 *
 * @author vesprada
 */
public class NewClass {

    public static void main(String[] args) {
        int[] v = {1,2,3,4,5};
        int aux, i, j;
        int c=0,c2=0;
        int N = v.length;
        for (i = 1; i < N; i++) {
            aux = v[i];
            c2++;
            for (j = i; (j > 0) && (aux < v[j - 1]); j--) {
                v[j] = v[j - 1];
                c++;
            }
            v[j] = aux;
        }
        System.out.println(c+" veces");
        System.out.println(c2+" veces");

    }
}
